package commonClass;

import java.util.ArrayList;

import android.app.ProgressDialog;
import android.content.Context;
import android.util.Log;
import commonClass.DataLink.ICompeletListener;

public class FunctionDispatcher {
	private final String TAG = "FunctionDispatcher";
	//private ProgressDialog progressDialog = null;
	String jsonResult = "";
	
	public void exceute(String methodName,ArrayList<Object> list,final IAnimalDoctorAction iAction, final IRequestCompeletListener requestCompeletListener, Context context){
		
		String paramters = iAction.object2json(list);
		/* progressDialog = ProgressDialog.show(context , null , "正在登陆");*/
		DataLink dataLink = new DataLink();
		
		//private String Urlofzhengzhuangfz = "http://59.68.29.72:8081/AnimalDoctor/querySymptomsCategorieByAnimalIDAction?appKey=b6d0027729f5c6a3&animalID=01371054603";
		dataLink.post(  methodName ,  paramters, new ICompeletListener() {
			public void doCompelet(String result){
				Log.v(TAG, "post:" + result);
				/*Log.v("22222" , result);*/
				jsonResult = result;
				requestCompeletListener.doCompelet(iAction.json2object(result));
			}
		} , context);//这里实现了post的接口
	}
	public interface IRequestCompeletListener {
		public void doCompelet(ArrayList<Object> resultList) ;
	}
}
